{{-- resources\views\custom\phpFunction.blade.php --}}
@php
    function cut_str($str,$len=16,$suffix="…"){
        if(strlen($str) > $len){
            if(function_exists('mb_substr')){
                $str = mb_substr($str,0,$len,'utf-8').$suffix;
                // $str = mb_substr($str,0,$len,'utf-8');
            }else{
                $str= substr($str,0,$len,'utf-8').$suffix;
                // $str= substr($str,0,$len,'utf-8');
            }     
        } 
        return $str; 
    }
    function merge_str($str1,$str2,$suffix="——"){
        $str = $str1;
        if ($str2 != null) {
            $str .= $suffix.$str2;
        }
        return $str;
    }
    function objectToArray($object) {
        $jsonString = json_encode($object);
        $array = json_decode($jsonString, true);
        
        return $array;
    }
@endphp